<style>
    /* 根据字数修改 */
    .layui-form-label {
        width: 90px;
    }

    .layui-form-item .layui-input-inline {
        width: 240px;
    }
</style>
<div class="layuimini-container layuimini-page-anim">
    <!-- 用于创建子页面 -->
    <div class="page-create"></div>

    <!-- page-main-create -->
    <!-- 用于显示 隐藏 -->
    <div class="layuimini-main page-main-create">
        <div class="title-row layuimini-title ">
            <div class="title-left">
                <h4><span>工单派发</span></h4>
            </div>
            <div class="title-right">
                <span class="title-right-text">
                    <button type="button" class="layui-btn  layui-btn-sm ml-3" lay-on="download">刷新</button>
                </span>
            </div>
        </div>
        



        <div class="section table-stripe">
            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
        </div>
        <script type="text/html" id="currentTableBar">
            <a class="layui-font-blue mr-3" lay-event="detail">查看</a>
          
        </script>

    </div>
</div>
<script>
    layui.use(['form', 'table', 'tabs', 'miniPage', 'element'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            tabs = layui.tabs,
            laydate = layui.laydate,
            layer = layui.layer,
            util = layui.util,
            element = layui.element,
            miniPage = layui.miniPage;
        /******************** 事件 start ********************/

        util.on('lay-on', {
            //导出
            'download': function () {
                console.log('导出---')
            }
        })
        /******************** 事件 end ********************/



        /******************** 渲染组件 start ********************/
        form.render('select'); //刷新select选择框渲染

        /******************** 渲染组件 end ********************/

        table.render({
            elem: '#currentTableId',
            url: 'api/table.json',
            cols: [[
                { type: 'numbers', width: 80, title: '序号' },
                { field: 'name', minWidth: 100, title: '编号' },
                { field: 'sign', minWidth: 100, title: '类型' },
                { field: 'score', minWidth: 80, title: '所属项目' },
                { field: 'classify', minWidth: 80, title: '位置' },
                { field: 'city', minWidth: 80, title: '部件' },
                { field: 'wealth', minWidth: 135, title: '原因' },
                { field: 'time', title: '派发时间', minWidth: 150 },
                { field: 'time', minWidth: 135, title: '处理人' },
                { field: 'time', minWidth: 135, title: '状态' },
                { title: '操作', minWidth: 100, toolbar: '#currentTableBar', align: "center" }
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            size: 'lg'
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            layer.alert(result, {
                title: '最终的搜索信息'
            });

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });




        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'detail') {  // 监听详情操作
                var content = miniPage.getHrefContent('page/processSupervision/batchDelivery/components/batchDeliveryDetail.html');
                var openWH = miniPage.getOpenWidthHeight();
                var index = layer.open({
                    title: '工单详情<span class="ml-3 layui-badge layui-bg-blue">处理中</span>',
                    type: 1,
                    shade: 0.2,
                    maxmin: false,
                    shadeClose: true,
                    area: ['1200px', 'auto'],
                    content: content
                });
            }
        });

        // 开启监听 折叠展开事件
        miniPage.listen()

    });
</script>